
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>九、数据结构 · 计算机笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="海拉尔的三角">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro-fixed/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-ancre-navigation/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-insert-logo-link-website/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-auto-scroll-table/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-katex-pro/katex.min.css">
                
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-terminull-light/terminull.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="array_list_withNum.html" />
    
    
    <link rel="prev" href="stl_withNum.html" />
    

    
        <link rel="shortcut icon" href="image/ico.png" type="image/x-icon">
    
    
    
    
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="image/ico.png">
    
    
        
    
    
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://github.com/spite-triangle" target="_blank" class="custom-link">Github</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../cpp.html">
            
                <a href="../cpp.html">
            
                    
                    C/C++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="foundation_withNum.html">
            
                <a href="foundation_withNum.html">
            
                    
                    一、基础概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="keyword_withNum.html">
            
                <a href="keyword_withNum.html">
            
                    
                    二、关键字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="point_reference_withNum.html">
            
                <a href="point_reference_withNum.html">
            
                    
                    三、指针与引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="oop_withNum.html">
            
                <a href="oop_withNum.html">
            
                    
                    四、面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="memory_withNum.html">
            
                <a href="memory_withNum.html">
            
                    
                    五、内存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="process_withNum.html">
            
                <a href="process_withNum.html">
            
                    
                    六、进程与线程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="locks_withNum.html">
            
                <a href="locks_withNum.html">
            
                    
                    七、锁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="stl_withNum.html">
            
                <a href="stl_withNum.html">
            
                    
                    八、STL
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.1.9" data-path="dataStruction_withNum.html">
            
                <a href="dataStruction_withNum.html">
            
                    
                    九、数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="array_list_withNum.html">
            
                <a href="array_list_withNum.html">
            
                    
                    十、数组链表操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.11" data-path="find_withNum.html">
            
                <a href="find_withNum.html">
            
                    
                    十一、目标查找
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.12" data-path="tree_withNum.html">
            
                <a href="tree_withNum.html">
            
                    
                    十二、树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.13" data-path="binaryTree_withNum.html">
            
                <a href="binaryTree_withNum.html">
            
                    
                    十三、二叉树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.14" data-path="dynamicProgram_withNum.html">
            
                <a href="dynamicProgram_withNum.html">
            
                    
                    十四、动态规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.15" data-path="backtracking_withNum.html">
            
                <a href="backtracking_withNum.html">
            
                    
                    十五、回溯算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.16" data-path="monotoneStack_withNum.html">
            
                <a href="monotoneStack_withNum.html">
            
                    
                    十六、单调栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.17" data-path="toollib_withNum.html">
            
                <a href="toollib_withNum.html">
            
                    
                    附录 工具库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../../MySQL/mysql.html">
            
                <a href="../../MySQL/mysql.html">
            
                    
                    MySQL
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../../MySQL/chapter/introduction_withNum.html">
            
                <a href="../../MySQL/chapter/introduction_withNum.html">
            
                    
                    一、简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../../MySQL/chapter/foundation_withNum.html">
            
                <a href="../../MySQL/chapter/foundation_withNum.html">
            
                    
                    二、控制台操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../../MySQL/chapter/operatorDB_withNum.html">
            
                <a href="../../MySQL/chapter/operatorDB_withNum.html">
            
                    
                    三、数据库、表操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="../../MySQL/chapter/operatorData_withNum.html">
            
                <a href="../../MySQL/chapter/operatorData_withNum.html">
            
                    
                    四、数据操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5" data-path="../../MySQL/chapter/transaction_withNum.html">
            
                <a href="../../MySQL/chapter/transaction_withNum.html">
            
                    
                    五、事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6" data-path="../../MySQL/chapter/index_withNum.html">
            
                <a href="../../MySQL/chapter/index_withNum.html">
            
                    
                    六、索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7" data-path="../../MySQL/chapter/authority_withNum.html">
            
                <a href="../../MySQL/chapter/authority_withNum.html">
            
                    
                    七、权限管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.8" data-path="../../MySQL/chapter/backup_withNum.html">
            
                <a href="../../MySQL/chapter/backup_withNum.html">
            
                    
                    八、备份
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../../linux/linux.html">
            
                <a href="../../linux/linux.html">
            
                    
                    Linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../../linux/chapter/foundation_withNum.html">
            
                <a href="../../linux/chapter/foundation_withNum.html">
            
                    
                    一、原理知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../../linux/chapter/command_withNum.html">
            
                <a href="../../linux/chapter/command_withNum.html">
            
                    
                    二、指令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../../tcp_udp/tcp_upd.html">
            
                <a href="../../tcp_udp/tcp_upd.html">
            
                    
                    网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="../../tcp_udp/chapter/foundation_withNum.html">
            
                <a href="../../tcp_udp/chapter/foundation_withNum.html">
            
                    
                    一、网络通讯基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2" data-path="../../tcp_udp/chapter/tcp_udp_withNum.html">
            
                <a href="../../tcp_udp/chapter/tcp_udp_withNum.html">
            
                    
                    二、tcp/udp
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >九、数据结构</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-anchor"></i><ul><li><span class="title-icon "></span><a href="#&#x6570;&#x636E;&#x7ED3;&#x6784;"><b></b>&#x6570;&#x636E;&#x7ED3;&#x6784;</a></li><li><span class="title-icon "></span><a href="#1-&#x6570;&#x636E;&#x7ED3;&#x6784;"><b></b>1. &#x6570;&#x636E;&#x7ED3;&#x6784;</a></li><ul><li><span class="title-icon "></span><a href="#11-&#x57FA;&#x672C;&#x6982;&#x5FF5;"><b></b>1.1. &#x57FA;&#x672C;&#x6982;&#x5FF5;</a></li><li><span class="title-icon "></span><a href="#12-&#x6570;&#x636E;&#x7ED3;&#x6784;"><b></b>1.2. &#x6570;&#x636E;&#x7ED3;&#x6784;</a></li></ul><li><span class="title-icon "></span><a href="#2-&#x5B57;&#x7B26;&#x4E32;"><b></b>2. &#x5B57;&#x7B26;&#x4E32;</a></li><ul><li><span class="title-icon "></span><a href="#21-c&#x98CE;&#x683C;"><b></b>2.1. c&#x98CE;&#x683C;</a></li><li><span class="title-icon "></span><a href="#22--c&#x5B57;&#x7B26;&#x4E32;"><b></b>2.2.  c++&#x5B57;&#x7B26;&#x4E32;</a></li></ul><li><span class="title-icon "></span><a href="#3-&#x6808;-stack"><b></b>3. &#x6808; stack</a></li><li><span class="title-icon "></span><a href="#4-&#x961F;&#x5217;-queue"><b></b>4. &#x961F;&#x5217; queue</a></li><li><span class="title-icon "></span><a href="#5-vector"><b></b>5. vector</a></li><ul><li><span class="title-icon "></span><a href="#51-&#x5E95;&#x5C42;&#x5B9E;&#x73B0;"><b></b>5.1. &#x5E95;&#x5C42;&#x5B9E;&#x73B0;</a></li><li><span class="title-icon "></span><a href="#52-&#x5185;&#x5B58;&#x7BA1;&#x7406;"><b></b>5.2. &#x5185;&#x5B58;&#x7BA1;&#x7406;</a></li><ul><li><span class="title-icon "></span><a href="#521-&#x5185;&#x5B58;&#x5C5E;&#x6027;"><b></b>5.2.1. &#x5185;&#x5B58;&#x5C5E;&#x6027;</a></li><li><span class="title-icon "></span><a href="#522-&#x5185;&#x5B58;&#x4FEE;&#x6539;"><b></b>5.2.2. &#x5185;&#x5B58;&#x4FEE;&#x6539;</a></li><li><span class="title-icon "></span><a href="#523-&#x5185;&#x5B58;&#x6269;&#x5C55;"><b></b>5.2.3. &#x5185;&#x5B58;&#x6269;&#x5C55;</a></li></ul><li><span class="title-icon "></span><a href="#53-&#x6392;&#x5E8F;"><b></b>5.3. &#x6392;&#x5E8F;</a></li></ul><li><span class="title-icon "></span><a href="#6-mapmultimap"><b></b>6. map/multimap</a></li><li><span class="title-icon "></span><a href="#7-setmultiset"><b></b>7. set/multiset</a></li><li><span class="title-icon "></span><a href="#8-deque"><b></b>8. deque</a></li></ul></div><a href="#&#x6570;&#x636E;&#x7ED3;&#x6784;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 style="font-size:60px;text-align:center;" id="&#x6570;&#x636E;&#x7ED3;&#x6784;"><a name="&#x6570;&#x636E;&#x7ED3;&#x6784;" class="anchor-navigation-ex-anchor" href="#&#x6570;&#x636E;&#x7ED3;&#x6784;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6570;&#x636E;&#x7ED3;&#x6784;</h1>

<p>&#x53C2;&#x8003;&#x535A;&#x5BA2;&#xFF1A;</p>
<ul>
<li><a href="https://blog.csdn.net/qq_31196849/article/details/78529724" target="_blank">&#x6570;&#x636E;&#x7ED3;&#x6784;&#x57FA;&#x7840;&#x6982;&#x5FF5;&#x7BC7;</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/109110396#:~:text=%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%EF%BC%88Data%20Structure%EF%BC%89%E6%98%AF%E6%8C%87%E7%9B%B8%E4%BA%92%E4%B9%8B%E9%97%B4%E5%AD%98%E5%9C%A8%E4%B8%80%E7%A7%8D%E6%88%96%E5%A4%9A%E7%A7%8D%E7%89%B9%E5%AE%9A%E5%85%B3%E7%B3%BB%E7%9A%84%E6%95%B0%E6%8D%AE%E5%85%83%E7%B4%A0%E7%9A%84%E9%9B%86%E5%90%88%E3%80%82%20%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E5%8C%85%E6%8B%AC,3%20%20%E6%96%B9%E9%9D%A2%E7%9A%84%E5%86%85%E5%AE%B9%EF%BC%9A%E9%80%BB%E8%BE%91%E7%BB%93%E6%9E%84%EF%BC%8C%E5%AD%98%E5%82%A8%E7%BB%93%E6%9E%84%E5%92%8C%E5%AF%B9%E6%95%B0%E6%8D%AE%E7%9A%84%E8%BF%90%E7%AE%97%E3%80%82%20%E6%95%B0%E6%8D%AE%E7%9A%84%E9%80%BB%E8%BE%91%E7%BB%93%E6%9E%84%E6%98%AF%E5%AF%B9%E6%95%B0%E6%8D%AE%E4%B9%8B%E9%97%B4%E5%85%B3%E7%B3%BB%E7%9A%84%E6%8F%8F%E8%BF%B0%EF%BC%8C%E5%AE%83%E4%B8%8E%E6%95%B0%E6%8D%AE%E7%9A%84%E5%AD%98%E5%82%A8%E7%BB%93%E6%9E%84%E6%97%A0%E5%85%B3%EF%BC%8C%E5%90%8C%E4%B8%80%E7%A7%8D%E9%80%BB%E8%BE%91%E7%BB%93%E6%9E%84%E5%8F%AF%E4%BB%A5%E6%9C%89%E5%A4%9A%E7%A7%8D%E5%AD%98%E5%82%A8%E7%BB%93%E6%9E%84%E3%80%82" target="_blank">&#x6570;&#x636E;&#x7ED3;&#x6784;&#x7684;&#x57FA;&#x672C;&#x6982;&#x5FF5;</a></li>
</ul>
<h1 id="1-&#x6570;&#x636E;&#x7ED3;&#x6784;"><a name="1-&#x6570;&#x636E;&#x7ED3;&#x6784;" class="anchor-navigation-ex-anchor" href="#1-&#x6570;&#x636E;&#x7ED3;&#x6784;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x6570;&#x636E;&#x7ED3;&#x6784;</h1>
<p style="text-align:center;"><a href="../../image/cpp/dataStruct.jpg" data-lightbox="9ca415c9-4a00-4c8a-8578-3e6f46f103e3" data-title="undefined"><img src="../../image/cpp/dataStruct.jpg" alt="undefined"></a></p>

<h2 id="11-&#x57FA;&#x672C;&#x6982;&#x5FF5;"><a name="11-&#x57FA;&#x672C;&#x6982;&#x5FF5;" class="anchor-navigation-ex-anchor" href="#11-&#x57FA;&#x672C;&#x6982;&#x5FF5;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. &#x57FA;&#x672C;&#x6982;&#x5FF5;</h2>
<ul>
<li><strong>&#x6570;&#x636E;</strong></li>
</ul>
<p>&#x5BF9;&#x5BA2;&#x89C2;&#x4E8B;&#x7269;&#x7684;&#x7B26;&#x53F7;&#x8868;&#x793A;&#xFF0C;&#x6307;&#x6240;&#x6709;&#x80FD;&#x8F93;&#x5165;&#x5230;&#x8BA1;&#x7B97;&#x673A;&#x4E2D;&#x5E76;&#x88AB;&#x8BA1;&#x7B97;&#x673A;&#x7A0B;&#x5E8F;&#x5904;&#x7406;&#x7684;&#x300C;<strong>&#x7B26;&#x53F7;&#x603B;&#x79F0;</strong>&#x300D;&#x3002;</p>
<ul>
<li><strong>&#x6570;&#x636E;&#x5143;&#x7D20;</strong></li>
</ul>
<p><strong>&#x6570;&#x636E;&#x5143;&#x7D20;&#xFF08;<code>data element</code>&#xFF09;&#x6570;&#x636E;&#x7684;&#x57FA;&#x672C;&#x5355;&#x4F4D;</strong>&#xFF0C;&#x4E5F;&#x79F0;&#x7ED3;&#x70B9;&#xFF08;node&#xFF09;&#x6216;&#x8BB0;&#x5F55;&#xFF08;record&#xFF09;&#xFF0C;&#x5728;&#x8BA1;&#x7B97;&#x673A;&#x7A0B;&#x5E8F;&#x4E2D;&#x901A;&#x5E38;&#x5C06;&#x5176;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x6574;&#x4F53;&#x8FDB;&#x884C;&#x8003;&#x8651;&#x548C;&#x5904;&#x7406;&#x3002;&#x6709;&#x65F6;&#xFF0C;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5143;&#x7D20;&#x53EF;&#x7531;&#x82E5;&#x5E72;&#x4E2A;&#x300C;<strong>&#x6570;&#x636E;&#x9879;</strong>&#x300D;&#x7EC4;&#x6210;&#x3002;</p>
<blockquote>
<p>&#x4F8B;&#x5B50;&#xFF1A;&#x4E00;&#x672C;&#x4E66;&#x7684;&#x4E66;&#x76EE;&#x4FE1;&#x606F;&#x4E3A;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5143;&#x7D20;&#xFF0C;&#x800C;&#x4E66;&#x76EE;&#x4FE1;&#x606F;&#x7684;&#x6BCF;&#x4E00;&#x9879;&#xFF08;&#x5982;&#x4E66;&#x540D;&#xFF0C;&#x4F5C;&#x8005;&#x540D;&#x7B49;&#xFF09;&#x4E3A;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x9879;&#x3002;</p>
</blockquote>
<ul>
<li><strong>&#x6570;&#x636E;&#x9879;</strong></li>
</ul>
<p>&#x6570;&#x636E;&#x9879;&#xFF08;<code>data item</code>&#xFF09;&#x662F;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x4E2D;&#x8BA8;&#x8BBA;&#x7684;&#x300C;&#x6700;&#x5C0F;&#x5355;&#x4F4D;&#x300D;&#xFF0C;&#x662F;&#x6570;&#x636E;&#x8BB0;&#x5F55;&#x4E2D;&#x6700;&#x57FA;&#x672C;&#x7684;&#xFF0C;&#x4E0D;&#x53EF;&#x5206;&#x7684;&#x6570;&#x636E;&#x5355;&#x4F4D;&#xFF0C;&#x4E5F;&#x79F0;&#x57DF;&#xFF08;<code>field</code>&#xFF09;&#x3002;</p>
<ul>
<li><strong>&#x6570;&#x636E;&#x5BF9;&#x8C61;</strong></li>
</ul>
<p>&#x6570;&#x636E;&#x5BF9;&#x8C61;&#xFF08;<code>Data Object</code>&#xFF09;&#x662F;&#x5728;&#x6570;&#x636E;&#x4E2D;&#xFF0C;<strong>&#x6240;&#x6709;</strong>&#x6027;&#x8D28;&#x76F8;&#x540C;&#x7684;&#x300C;&#x6570;&#x636E;&#x5143;&#x7D20;&#x300D;&#x7684;&#x96C6;&#x5408;&#xFF0C;&#x662F;&#x6570;&#x636E;&#x7684;&#x4E00;&#x4E2A;&#x5B50;&#x96C6;&#x3002;</p>
<blockquote>
<p>&#x4F8B;&#x5982;&#xFF1A;&#x5927;&#x5199;&#x5B57;&#x6BCD;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5BF9;&#x8C61;&#xFF0C;&#x5927;&#x5199;&#x5B57;&#x6BCD;&#x6570;&#x636E;&#x5BF9;&#x8C61;&#x662F;&#x96C6;&#x5408;{&#x2019;A&#x2019;,&#x2019;B&#x2019;&#x2026;&#x2026;&#x2019;Z&#x2019;}&#x3002;</p>
</blockquote>
<ul>
<li><strong>&#x6570;&#x636E;&#x7ED3;&#x6784;</strong></li>
</ul>
<p>&#x6570;&#x636E;&#x7ED3;&#x6784;&#xFF08;<code>Data Structure</code>&#xFF09;&#x662F;&#x6307;&#x76F8;&#x4E92;&#x4E4B;&#x95F4;&#x5B58;&#x5728;&#x4E00;&#x79CD;&#x6216;&#x591A;&#x79CD;&#x7279;&#x5B9A;<strong>&#x5173;&#x7CFB;</strong>&#x7684;&#x300C;&#x6570;&#x636E;&#x5143;&#x7D20;&#x300D;&#x7684;&#x96C6;&#x5408;&#x3002;</p>
<p style="text-align:center;"><a href="../../image/cpp/object_structure.jpg" data-lightbox="240a40b5-3037-40a0-9d15-91443bb875ea" data-title="undefined"><img src="../../image/cpp/object_structure.jpg" alt="undefined"></a></p>

<h2 id="12-&#x6570;&#x636E;&#x7ED3;&#x6784;"><a name="12-&#x6570;&#x636E;&#x7ED3;&#x6784;" class="anchor-navigation-ex-anchor" href="#12-&#x6570;&#x636E;&#x7ED3;&#x6784;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. &#x6570;&#x636E;&#x7ED3;&#x6784;</h2>
<p><span style="font-size:24px;font-weight:bold" class="section2">1. &#x6570;&#x636E;&#x7684;&#x903B;&#x8F91;&#x7ED3;&#x6784;</span></p>
<p><strong>&#x5B9A;&#x4E49;&#xFF1A;&#x5BF9;&#x6570;&#x636E;&#x4E4B;&#x95F4;&#x300C;&#x5173;&#x7CFB;&#x300D;&#x7684;&#x63CF;&#x8FF0;&#xFF0C;&#x5B83;&#x4E0E;&#x6570;&#x636E;&#x7684;&#x300C;&#x5B58;&#x50A8;&#x7ED3;&#x6784;&#x300D;&#x65E0;&#x5173;&#xFF0C;&#x540C;&#x4E00;&#x79CD;&#x903B;&#x8F91;&#x7ED3;&#x6784;&#x53EF;&#x4EE5;&#x6709;&#x591A;&#x79CD;&#x5B58;&#x50A8;&#x7ED3;&#x6784;&#x3002;</strong></p>
<p style="text-align:center;"><a href="../../image/cpp/datastructuretypes.png" data-lightbox="ab407b61-29fd-4ca6-a459-27b7eb868608" data-title="undefined"><img src="../../image/cpp/datastructuretypes.png" alt="undefined"></a></p>

<blockquote>
<p>[!tip]</p>
<ul>
<li><strong>&#x96C6;&#x5408;</strong> : &#x7ED3;&#x6784;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x5143;&#x7D20;&#x9664;&#x4E86;&#x540C;&#x5C5E;&#x4E8E;&#x4E00;&#x79CD;&#x7C7B;&#x578B;&#x5916;&#xFF0C;&#x522B;&#x65E0;&#x5176;&#x5B83;&#x5173;&#x7CFB;&#x3002;</li>
<li><strong>&#x7EBF;&#x6027;&#x7ED3;&#x6784;</strong> : &#x6570;&#x636E;&#x5143;&#x7D20;&#x4E4B;&#x95F4;&#x4E00;&#x5BF9;&#x4E00;&#x7684;&#x5173;&#x7CFB;</li>
<li><strong>&#x6811;&#x5F62;&#x7ED3;&#x6784;</strong> : &#x6570;&#x636E;&#x5143;&#x7D20;&#x4E4B;&#x95F4;&#x4E00;&#x5BF9;&#x591A;&#x7684;&#x5173;&#x7CFB;</li>
<li><strong>&#x56FE;&#x72B6;&#x7ED3;&#x6784;&#x6216;&#x7F51;&#x72B6;&#x7ED3;&#x6784;</strong> : &#x7ED3;&#x6784;&#x4E2D;&#x7684;&#x6570;&#x636E;&#x5143;&#x7D20;&#x4E4B;&#x95F4;&#x5B58;&#x5728;&#x591A;&#x5BF9;&#x591A;&#x7684;&#x5173;&#x7CFB;</li>
</ul>
</blockquote>
<ul>
<li><strong>&#x7EBF;&#x6027;&#x7ED3;&#x6784;&#xFF1A;</strong> &#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5143;&#x7D20;&#x7684;&#x6709;&#x5E8F;&#xFF08;&#x6B21;&#x5E8F;&#xFF09;&#x96C6;&#x5408;&#xFF0C;&#x300C;&#x6570;&#x636E;&#x5143;&#x7D20;&#xFF08;&#x7ED3;&#x70B9;&#xFF09;&#x300D;&#x4E4B;&#x95F4;&#x5B58;&#x5728;&#x7740;&#x300C;&#x4E00;&#x5BF9;&#x4E00;&#x300D;&#x7684;<strong>&#x5173;&#x7CFB;</strong>&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;&#x94FE;&#x8868;&#xFF0C;&#x6570;&#x7EC4;<ul>
<li>&#x96C6;&#x5408;&#x4E2D;&#x5FC5;&#x5B58;&#x5728;&#x552F;&#x4E00;&#x7684;&#x4E00;&#x4E2A;&#x300C;&#x7B2C;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x300D;</li>
<li>&#x96C6;&#x5408;&#x4E2D;&#x5FC5;&#x5B58;&#x5728;&#x552F;&#x4E00;&#x7684;&#x4E00;&#x4E2A;&#x300C;&#x6700;&#x540E;&#x7684;&#x5143;&#x7D20;&#x300D;</li>
<li>&#x9664;&#x6700;&#x540E;&#x5143;&#x7D20;&#x4E4B;&#x5916;&#xFF0C;&#x5176;&#x5B83;&#x6570;&#x636E;&#x5143;&#x7D20;&#x5747;&#x6709;&#x552F;&#x4E00;&#x7684;&#x300C;&#x540E;&#x7EE7;&#x300D;</li>
<li>&#x9664;&#x7B2C;&#x4E00;&#x5143;&#x7D20;&#x4E4B;&#x5916;&#xFF0C;&#x5176;&#x5B83;&#x6570;&#x636E;&#x5143;&#x7D20;&#x5747;&#x6709;&#x552F;&#x4E00;&#x7684;&#x300C;&#x524D;&#x9A71;&#x300D;</li>
</ul>
</li>
<li><strong>&#x975E;&#x7EBF;&#x6027;&#x7ED3;&#x6784;&#xFF1A;</strong> &#x975E;&#x7EBF;&#x6027;&#x7ED3;&#x6784;&#x4E2D;&#x7684;&#x300C;&#x7ED3;&#x70B9;&#xFF08;&#x6570;&#x636E;&#x5143;&#x7D20;&#xFF09;&#x300D;&#x5B58;&#x5728;&#x7740;&#x300C;&#x4E00;&#x5BF9;&#x591A;&#x300D;&#x7684;<strong>&#x5173;&#x7CFB;</strong>&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;&#x56FE;&#xFF0C;&#x6811;</li>
</ul>
<p><span style="font-size:24px;font-weight:bold" class="section2">2. &#x6570;&#x636E;&#x7684;&#x7269;&#x7406;&#x7ED3;&#x6784;</span></p>
<p><strong>&#x5B9A;&#x4E49;&#xFF1A;&#x53C8;&#x79F0;&#x4E3A;&#x5B58;&#x50A8;&#x7ED3;&#x6784;&#xFF0C;&#x662F;&#x6570;&#x636E;&#x7684;&#x903B;&#x8F91;&#x7ED3;&#x6784;&#x5728;&#x8BA1;&#x7B97;&#x673A;&#x4E2D;&#x7684;&#x300C;&#x8868;&#x793A;&#x300D;&#xFF08;&#x53C8;&#x79F0;&#x6620;&#x50CF;&#xFF09;&#xFF0C;&#x5B83;&#x5305;&#x62EC;&#x6570;&#x636E;&#x5143;&#x7D20;&#x7684;&#x8868;&#x793A;&#x548C;&#x5173;&#x7CFB;&#x7684;&#x8868;&#x793A;&#x3002;</strong></p>
<p style="text-align:center;"><a href="../../image/cpp/dataStorage.png" data-lightbox="96717a79-3f97-4175-9a3b-d5cd170ecffb" data-title="undefined"><img src="../../image/cpp/dataStorage.png" alt="undefined"></a></p>

<ul>
<li><strong>&#x987A;&#x5E8F;&#x5B58;&#x50A8;&#x7ED3;&#x6784;</strong>&#xFF1A;&#x6570;&#x7EC4;&#xFF0C;&#x5185;&#x5B58;&#x90FD;&#x6328;&#x7740;&#x7684;</li>
<li><strong>&#x94FE;&#x5F0F;&#x5B58;&#x50A8;&#x7ED3;&#x6784;</strong>&#xFF1A;&#x94FE;&#x8868;&#xFF0C;&#x4E1C;&#x4E00;&#x5757;&#x897F;&#x4E00;&#x5757;&#x7684;</li>
</ul>
<p><span style="font-size:24px;font-weight:bold" class="section2">3. &#x6570;&#x636E;&#x7ED3;&#x6784;&#x8BBE;&#x8BA1;&#x51C6;&#x5219;</span></p>
<p><strong>&#x300C;&#x903B;&#x8F91;&#x7ED3;&#x6784;&#x300D;&#x4E0E;&#x300C;&#x7269;&#x7406;&#x7ED3;&#x6784;&#x300D;&#x7684;&#x89E3;&#x8026;&#x3002;</strong></p>
<ul>
<li>&#x300C;&#x903B;&#x8F91;&#x7ED3;&#x6784;&#x300D;&#xFF1A;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5728;&#x300C;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x300D;&#x4E0A;&#x7684;&#x300C;&#x5177;&#x4F53;&#x64CD;&#x4F5C;&#x300D;</li>
<li>&#x300C;&#x7269;&#x7406;&#x7ED3;&#x6784;&#x300D;&#xFF1A;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5728;&#x300C;&#x7269;&#x7406;&#x5B58;&#x50A8;&#x300D;&#x4E0A;&#x7684;&#x300C;&#x5177;&#x4F53;&#x5B9E;&#x73B0;&#x300D;</li>
</ul>
<blockquote>
<p>[!tip]</p>
<ul>
<li><strong>&#x987A;&#x5E8F;&#x8868;&#xFF1A;</strong> &#x7EBF;&#x6027;&#xFF08;&#x903B;&#x8F91;&#x7ED3;&#x6784;&#xFF09;&#x8868;&#x91C7;&#x7528;&#x987A;&#x5E8F;&#x5B58;&#x50A8;&#xFF08;&#x7269;&#x7406;&#x7ED3;&#x6784;&#xFF09;&#xFF0C;&#x5373;&#x903B;&#x8F91;&#x7ED3;&#x6784;&#x548C;&#x7269;&#x7406;&#x7ED3;&#x679C;&#x5747;&#x662F;&#x7EBF;&#x6027;&#x7684;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;&#x6570;&#x7EC4;&#x3002;</li>
</ul>
</blockquote>
<h1 id="2-&#x5B57;&#x7B26;&#x4E32;"><a name="2-&#x5B57;&#x7B26;&#x4E32;" class="anchor-navigation-ex-anchor" href="#2-&#x5B57;&#x7B26;&#x4E32;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x5B57;&#x7B26;&#x4E32;</h1>
<h2 id="21-c&#x98CE;&#x683C;"><a name="21-c&#x98CE;&#x683C;" class="anchor-navigation-ex-anchor" href="#21-c&#x98CE;&#x683C;"><i class="fa fa-link" aria-hidden="true"></i></a>2.1. c&#x98CE;&#x683C;</h2>
<ul>
<li>&#x5B57;&#x7B26;&#x4E32;&#x7ED3;&#x5C3E;&#x6807;&#x5FD7;&#x4E3A;  <code>\0</code></li>
<li><code>&quot; &quot;</code> : &#x81EA;&#x5E26; <code>\0</code></li>
<li><code>strcat</code> : <font color="#4c9df8">&#x4F1A;&#x81EA;&#x52A8;&#x52A0;  <code>\0</code> </font></li>
</ul>
<pre class="language-"><code class="lang-cpp"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;string.h&gt;</span></span>

<span class="token comment">// &#x521B;&#x5EFA;</span>
<span class="token keyword">char</span> str<span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token string">&quot;RUNOOB&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">char</span> <span class="token operator">*</span>str <span class="token operator">=</span>  <span class="token string">&quot;fuck&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">char</span> str<span class="token punctuation">[</span><span class="token number">7</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token string">&apos;R&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;U&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;N&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;O&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;O&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;B&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;\0&apos;</span><span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token comment">// &#x62F7;&#x8D1D;&#x5B57;&#x7B26;&#x4E32;</span>
<span class="token function">strcpy</span><span class="token punctuation">(</span><span class="token keyword">char</span> <span class="token operator">*</span>dest<span class="token punctuation">,</span> <span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>src<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x5C06;src&#x62F7;&#x8D1D;&#x5230;dest&#xFF0C;&#x62F7;&#x8D1D;&#x4EE5; \0 &#x4F5C;&#x7EC8;&#x6B62;;</span>
<span class="token keyword">char</span> <span class="token operator">*</span><span class="token function">strncpy</span><span class="token punctuation">(</span><span class="token keyword">char</span> <span class="token operator">*</span>dest<span class="token punctuation">,</span> <span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>src<span class="token punctuation">,</span> size_t n<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// n&#x6307;&#x5B9A;&#x957F;&#x5EA6;&#xFF0C;&#x66F4;&#x5B89;&#x5168;</span>

<span class="token comment">// &#x62FC;&#x63A5;&#x5B57;&#x7B26;&#x4E32;</span>
<span class="token keyword">char</span> <span class="token operator">*</span><span class="token function">strcat</span><span class="token punctuation">(</span><span class="token keyword">char</span> <span class="token operator">*</span>dest<span class="token punctuation">,</span> <span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>src<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x5F80;dest&#x4E0A;&#x52A0;&#x5B57;&#x7B26;&#x4E32;</span>

<span class="token comment">// &#x5B57;&#x7B26;&#x4E32;&#x957F;&#x5EA6;</span>
<span class="token function">strlen</span><span class="token punctuation">(</span>str<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// \0 &#x7EC8;&#x6B62;</span>

<span class="token comment">// &#x6BD4;&#x8F83;&#x5B57;&#x7B26;&#x4E32;</span>
<span class="token keyword">int</span> <span class="token function">strcmp</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>s1<span class="token punctuation">,</span> <span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>s2<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x76F8;&#x540C;&#x8FD4;&#x56DE; 0</span>

<span class="token comment">// &#x67E5;&#x627E;</span>
<span class="token keyword">char</span> <span class="token operator">*</span><span class="token function">strchr</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>str<span class="token punctuation">,</span> <span class="token keyword">int</span> c<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//&#x8FD4;&#x56DE;&#x7B2C;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4F4D;&#x7F6E;&#xFF0C;&#x6CA1;&#x6709;&#x8FD4;&#x56DE;NULL</span>
<span class="token keyword">char</span> <span class="token operator">*</span><span class="token function">strstr</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>haystack<span class="token punctuation">,</span> <span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>needle<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x8FD4;&#x56DE;&#x7B2C;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x4F4D;&#x7F6E;&#xFF0C;&#x6CA1;&#x6709;&#x8FD4;&#x56DE;NULL</span>
</code></pre>
<h2 id="22--c&#x5B57;&#x7B26;&#x4E32;"><a name="22--c&#x5B57;&#x7B26;&#x4E32;" class="anchor-navigation-ex-anchor" href="#22--c&#x5B57;&#x7B26;&#x4E32;"><i class="fa fa-link" aria-hidden="true"></i></a>2.2.  c++&#x5B57;&#x7B26;&#x4E32;</h2>
<ul>
<li><code>string</code> &#x662F;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;</li>
<li><code>string</code> &#x7684;&#x7ED3;&#x5C3E;&#x6CA1;&#x6709;&#x7ED3;&#x675F;&#x6807;&#x5FD7;  <code>\0</code></li>
<li><code>==</code> &#x53EF;&#x4EE5;&#x7528;&#x6765;&#x5224;&#x65AD;&#x5B57;&#x7B26;&#x4E32;&#x662F;&#x5426;&#x76F8;&#x540C;</li>
</ul>
<pre class="language-"><code class="lang-cpp"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;string&gt;</span></span>

<span class="token comment">// &#x521B;&#x5EFA;</span>
string str<span class="token punctuation">;</span> <span class="token comment">// s1&#x7684;&#x503C;&#x4E3A;NULL</span>
string str <span class="token operator">=</span> <span class="token string">&quot;c plus plus&quot;</span><span class="token punctuation">;</span>
string <span class="token function">str</span><span class="token punctuation">(</span>c&#x98CE;&#x683C;<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x5B57;&#x7B26;&#x4E32;&#x957F;&#x5EA6;</span>
str<span class="token punctuation">.</span><span class="token function">length</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x8F6C;c&#x98CE;&#x683C;</span>
str<span class="token punctuation">.</span><span class="token function">c_str</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x8BBF;&#x95EE;&#x5B57;&#x7B26;</span>
str<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>

<span class="token comment">// &#x6570;&#x5B57;&#x8F6C;&#x5B57;&#x7B26;&#x4E32;</span>
string <span class="token function">to_string</span><span class="token punctuation">(</span><span class="token keyword">int</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
string <span class="token function">to_string</span><span class="token punctuation">(</span><span class="token keyword">long</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
string <span class="token function">to_string</span><span class="token punctuation">(</span><span class="token keyword">double</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x5B57;&#x7B26;&#x8F6C;&#x6570;&#x5B57;</span>
<span class="token function">atoi</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span><span class="token operator">*</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">stoi</span><span class="token punctuation">(</span><span class="token keyword">const</span> string<span class="token operator">&amp;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">strtoi</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x63D2;&#x5165;</span>
string<span class="token operator">&amp;</span> <span class="token function">insert</span> <span class="token punctuation">(</span>size_t pos<span class="token punctuation">,</span> <span class="token keyword">const</span> string<span class="token operator">&amp;</span> str<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x5220;&#x9664;</span>
string<span class="token operator">&amp;</span> <span class="token function">erase</span> <span class="token punctuation">(</span>size_t pos <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> size_t len <span class="token operator">=</span> npos<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x83B7;&#x53D6;&#x5B50;&#x4E32;</span>
string <span class="token function">substr</span> <span class="token punctuation">(</span>size_t pos <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> size_t len <span class="token operator">=</span> npos<span class="token punctuation">)</span> <span class="token keyword">const</span><span class="token punctuation">;</span>

<span class="token comment">// &#x67E5;&#x627E; &#x8FD4;&#x56DE;&#x7B2C;&#x4E00;&#x4E2A;&#x627E;&#x5230;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x6CA1;&#x627E;&#x5230;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x65E0;&#x7A77;&#x6570;</span>
size_t <span class="token function">find</span> <span class="token punctuation">(</span><span class="token keyword">const</span> string<span class="token operator">&amp;</span> str<span class="token punctuation">,</span> size_t pos <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token keyword">const</span><span class="token punctuation">;</span>
size_t <span class="token function">find</span> <span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span><span class="token operator">*</span> s<span class="token punctuation">,</span> size_t pos <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token keyword">const</span><span class="token punctuation">;</span>
<span class="token function">find_first_of</span><span class="token punctuation">(</span><span class="token keyword">const</span> string<span class="token operator">&amp;</span> str<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x5B50;&#x5B57;&#x7B26;&#x4E32;&#x548C;&#x5B57;&#x7B26;&#x4E32;&#x5171;&#x540C;&#x5177;&#x6709;&#x7684;&#x5B57;&#x7B26;&#x5728;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x9996;&#x6B21;&#x51FA;&#x73B0;&#x7684;&#x4F4D;&#x7F6E;</span>
</code></pre>
<h1 id="3-&#x6808;-stack"><a name="3-&#x6808;-stack" class="anchor-navigation-ex-anchor" href="#3-&#x6808;-stack"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x6808; stack</h1>
<ul>
<li><font color="#f44336"> &#x6CA1;&#x6709;&#x8FED;&#x4EE3;&#x5668;&#x529F;&#x80FD;&#x3002; </font>

</li>
</ul>
<pre class="language-"><code class="lang-cpp"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;stack&gt;</span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;vector&gt;</span></span>
stack<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token operator">&gt;</span> s<span class="token punctuation">;</span>
stack<span class="token operator">&lt;</span> <span class="token keyword">int</span><span class="token punctuation">,</span> vector<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token operator">&gt;</span> <span class="token operator">&gt;</span> stk<span class="token punctuation">;</span>  <span class="token comment">//&#x8986;&#x76D6;&#x57FA;&#x7840;&#x5BB9;&#x5668;&#x7C7B;&#x578B;&#xFF0C;&#x4F7F;&#x7528;vector&#x5B9E;&#x73B0;stk</span>
s<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//&#x5224;&#x65AD;stack&#x662F;&#x5426;&#x4E3A;&#x7A7A;&#xFF0C;&#x4E3A;&#x7A7A;&#x8FD4;&#x56DE;true&#xFF0C;&#x5426;&#x5219;&#x8FD4;&#x56DE;false</span>
s<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//&#x8FD4;&#x56DE;stack&#x4E2D;&#x5143;&#x7D20;&#x7684;&#x4E2A;&#x6570;</span>

s<span class="token punctuation">.</span><span class="token function">pop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    <span class="token comment">//&#x5220;&#x9664;&#x6808;&#x9876;&#x5143;&#x7D20;&#xFF0C;&#x4F46;&#x4E0D;&#x8FD4;&#x56DE;&#x5176;&#x503C;</span>
s<span class="token punctuation">.</span><span class="token function">top</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    <span class="token comment">//&#x8FD4;&#x56DE;&#x6808;&#x9876;&#x5143;&#x7D20;&#x7684;&#x503C;&#xFF0C;&#x4F46;&#x4E0D;&#x5220;&#x9664;&#x6B64;&#x5143;&#x7D20;</span>

s<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span>item<span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//&#x5728;&#x6808;&#x9876;&#x538B;&#x5165;&#x65B0;&#x5143;&#x7D20;item</span>
</code></pre>
<h1 id="4-&#x961F;&#x5217;-queue"><a name="4-&#x961F;&#x5217;-queue" class="anchor-navigation-ex-anchor" href="#4-&#x961F;&#x5217;-queue"><i class="fa fa-link" aria-hidden="true"></i></a>4. &#x961F;&#x5217; queue</h1>
<ul>
<li><font color="#f44336"> &#x6CA1;&#x6709;&#x8FED;&#x4EE3;&#x5668;&#x529F;&#x80FD;&#x3002; </font>

</li>
</ul>
<pre class="language-"><code class="lang-cpp">queue<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token operator">&gt;</span> q<span class="token punctuation">;</span> <span class="token comment">//priority_queue&lt;int&gt; q;</span>
q<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//&#x5224;&#x65AD;&#x961F;&#x5217;&#x662F;&#x5426;&#x4E3A;&#x7A7A;</span>
q<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//&#x8FD4;&#x56DE;&#x961F;&#x5217;&#x957F;&#x5EA6;</span>

<span class="token comment">// &#x51FA;&#x961F;&#x548C;&#x5165;&#x961F;</span>
q<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span>item<span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//&#x5BF9;&#x4E8E;queue&#xFF0C;&#x5728;&#x961F;&#x5C3E;&#x538B;&#x5165;&#x4E00;&#x4E2A;&#x65B0;&#x5143;&#x7D20;</span>
q<span class="token punctuation">.</span><span class="token function">pop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//&#x5220;&#x9664; queue &#x4E2D;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x5143;&#x7D20;</span>

<span class="token comment">// &#x961F;&#x5217;&#x8BBF;&#x95EE;</span>
q<span class="token punctuation">.</span><span class="token function">front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//&#x8FD4;&#x56DE;&#x961F;&#x9996;&#x5143;&#x7D20;&#x7684;&#x503C;&#xFF0C;&#x4F46;&#x4E0D;&#x5220;&#x9664;&#x8BE5;&#x5143;&#x7D20;</span>
q<span class="token punctuation">.</span><span class="token function">back</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>   <span class="token comment">//&#x8FD4;&#x56DE;&#x961F;&#x5C3E;&#x5143;&#x7D20;&#x7684;&#x503C;&#xFF0C;&#x4F46;&#x4E0D;&#x5220;&#x9664;&#x8BE5;&#x5143;&#x7D20;</span>
</code></pre>
<h1 id="5-vector"><a name="5-vector" class="anchor-navigation-ex-anchor" href="#5-vector"><i class="fa fa-link" aria-hidden="true"></i></a>5. vector</h1>
<h2 id="51-&#x5E95;&#x5C42;&#x5B9E;&#x73B0;"><a name="51-&#x5E95;&#x5C42;&#x5B9E;&#x73B0;" class="anchor-navigation-ex-anchor" href="#51-&#x5E95;&#x5C42;&#x5B9E;&#x73B0;"><i class="fa fa-link" aria-hidden="true"></i></a>5.1. &#x5E95;&#x5C42;&#x5B9E;&#x73B0;</h2>
<p style="text-align:center;"><a href="../../image/cpp/vector_structure.gif" data-lightbox="d900c357-5ec5-4bf7-a092-b4ff4b9f9a38" data-title="undefined"><img src="../../image/cpp/vector_structure.gif" alt="undefined"></a></p>

<blockquote>
<p>[!tip]
<strong><code>vector</code>&#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x4EE5;&#x52A8;&#x6001;&#x6269;&#x5BB9;&#x7684;&#x300C;&#x6570;&#x7EC4;&#x300D;&#x3002;<code>_Myfirst</code> &#x6307;&#x5411;&#x7684;&#x662F; <code>vector</code> &#x5BB9;&#x5668;&#x5BF9;&#x8C61;&#x7684;&#x8D77;&#x59CB;&#x5B57;&#x8282;&#x4F4D;&#x7F6E;&#xFF1B;<code>_Mylast</code> &#x6307;&#x5411;&#x5F53;&#x524D;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x672B;&#x5C3E;&#x5B57;&#x8282;&#xFF1B;<code>_myend</code> &#x6307;&#x5411;&#x6574;&#x4E2A; <code>vector</code> &#x5BB9;&#x5668;&#x6240;&#x5360;&#x7528;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x7684;&#x672B;&#x5C3E;&#x5B57;&#x8282;&#x3002;</strong></p>
</blockquote>
<sec data-title="&#x5177;&#x4F53;&#x64CD;&#x4F5C;" data-id="vector_operator" data-show="true" data-collapse="true"><div class="panel panel-default"><div class="panel-heading"><b>&#x5177;&#x4F53;&#x64CD;&#x4F5C;<a class="pull-right section atTitle btn btn-default" target="vector_operator"><span class="fa fa-angle-up"></span></a></b></div><div class="panel-collapse in" id="vector_operator"><div class="panel-body">
<pre class="language-"><code class="lang-cpp"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;vector&gt;</span></span>

<span class="token comment">// &#x521B;&#x5EFA;</span>
vector<span class="token operator">&lt;</span>T<span class="token operator">&gt;</span> vec<span class="token punctuation">;</span>
vector<span class="token operator">&lt;</span>T<span class="token operator">&gt;</span> <span class="token function">vec</span><span class="token punctuation">(</span><span class="token keyword">int</span> nSize<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x6307;&#x5B9A;&#x5BB9;&#x5668;&#x521D;&#x59CB;&#x5927;&#x5C0F;</span>
<span class="token function">vector</span><span class="token punctuation">(</span><span class="token keyword">int</span> nSize<span class="token punctuation">,</span><span class="token keyword">const</span> T<span class="token operator">&amp;</span> initValue<span class="token punctuation">)</span><span class="token operator">:</span><span class="token comment">// &#x6307;&#x5B9A;&#x5BB9;&#x5668;&#x521D;&#x59CB;&#x503C;</span>

<span class="token comment">// &#x589E;&#x52A0;</span>
vec<span class="token punctuation">.</span><span class="token function">push_back</span><span class="token punctuation">(</span><span class="token keyword">const</span> T<span class="token operator">&amp;</span> item<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x5728;&#x5C41;&#x80A1;&#x6DFB;&#x52A0;</span>
iterator vec<span class="token punctuation">.</span><span class="token function">insert</span><span class="token punctuation">(</span>iterator it<span class="token punctuation">,</span><span class="token keyword">const</span> T<span class="token operator">&amp;</span> item<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x8FED;&#x4EE3;&#x5668;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x63D2;&#x5165;&#x5143;&#x7D20;</span>

<span class="token comment">// &#x5220;&#x9664;</span>
vec<span class="token punctuation">.</span><span class="token function">pop_back</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x5220;&#x9664;&#x5C41;&#x80A1;</span>
iterator <span class="token function">erase</span><span class="token punctuation">(</span>iterator it<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x5220;&#x9664;&#x8FED;&#x4EE3;&#x5668;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x5143;&#x7D20;</span>
vec<span class="token punctuation">.</span><span class="token function">clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x5220;&#x9664;&#x5168;&#x90E8;</span>

<span class="token comment">// &#x67E5;&#x627E;</span>
vec<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
vec<span class="token punctuation">.</span><span class="token function">at</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x4F1A;&#x68C0;&#x67E5;&#x662F;&#x5426;&#x8D8A;&#x754C;&#xFF0C;&#x63D0;&#x9AD8;&#x7A33;&#x5B9A;&#x6027;</span>

<span class="token comment">// &#x5BB9;&#x5668;&#x5185;&#x50A8;&#x5B58;&#x5143;&#x7D20;&#x4E2A;&#x6570;</span>
vec<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x5BB9;&#x5668;&#x662F;&#x5426;&#x6709;&#x4E1C;&#x897F;</span>
vec<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x8FED;&#x4EE3;&#x5668;&#x4F4D;&#x7F6E;</span>
vector<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span>iterator it <span class="token operator">=</span> vec<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x8D77;&#x59CB;&#x4F4D;&#x7F6E;</span>
vector<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span>iterator it <span class="token operator">=</span> vec<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x7ED3;&#x675F;&#x4F4D;&#x7F6E;</span>
<span class="token keyword">int</span> a <span class="token operator">=</span> <span class="token operator">*</span>it<span class="token punctuation">;</span> <span class="token comment">//&#x83B7;&#x53D6;&#x503C;</span>
<span class="token operator">*</span>it <span class="token operator">+=</span> <span class="token number">1</span><span class="token punctuation">;</span> 

<span class="token comment">// &#x5B9A;&#x4E49;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;</span>
 vector<span class="token operator">&lt;</span> vector<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token operator">&gt;</span> <span class="token operator">&gt;</span> <span class="token function">obj</span><span class="token punctuation">(</span>row<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// row&#x5B9A;&#x4E49;&#x884C;&#x6570;</span>
</code></pre>
</div></div></div></sec>
<h2 id="52-&#x5185;&#x5B58;&#x7BA1;&#x7406;"><a name="52-&#x5185;&#x5B58;&#x7BA1;&#x7406;" class="anchor-navigation-ex-anchor" href="#52-&#x5185;&#x5B58;&#x7BA1;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>5.2. &#x5185;&#x5B58;&#x7BA1;&#x7406;</h2>
<h3 id="521-&#x5185;&#x5B58;&#x5C5E;&#x6027;"><a name="521-&#x5185;&#x5B58;&#x5C5E;&#x6027;" class="anchor-navigation-ex-anchor" href="#521-&#x5185;&#x5B58;&#x5C5E;&#x6027;"><i class="fa fa-link" aria-hidden="true"></i></a>5.2.1. &#x5185;&#x5B58;&#x5C5E;&#x6027;</h3>
<ul>
<li><code>size = _Mylast - _Myfirst</code>: &#x6570;&#x636E;&#x771F;&#x6B63;&#x5B58;&#x50A8;&#x4E86;&#x591A;&#x5C11;&#x4E2A;&#x3002;</li>
<li><code>capacity = _Myend - _Myfirst</code>&#xFF1A;&#x9884;&#x5206;&#x914D;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x3002;</li>
</ul>
<pre class="language-"><code class="lang-cpp">vector<span class="token double-colon punctuation">::</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x83B7;&#x53D6; size</span>
vecotr<span class="token double-colon punctuation">::</span><span class="token function">capacity</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// &#x83B7;&#x53D6; capacity</span>
</code></pre>
<h3 id="522-&#x5185;&#x5B58;&#x4FEE;&#x6539;"><a name="522-&#x5185;&#x5B58;&#x4FEE;&#x6539;" class="anchor-navigation-ex-anchor" href="#522-&#x5185;&#x5B58;&#x4FEE;&#x6539;"><i class="fa fa-link" aria-hidden="true"></i></a>5.2.2. &#x5185;&#x5B58;&#x4FEE;&#x6539;</h3>
<ul>
<li><code>reserve(int)</code>&#xFF1A;<span style="color:red;font-weight:bold"> &#x4EC5;&#x4EC5;&#x53EA;&#x4FEE;&#x6539;<code>capacity</code>&#xFF0C;&#x4F46;&#x4E0D;&#x4F1A;&#x771F;&#x6B63;&#x7684;&#x521B;&#x5EFA;&#x5BF9;&#x8C61;&#x3002; </span></li>
<li><code>resize(int)</code>&#xFF1A;<span style="color:red;font-weight:bold"> &#x5206;&#x914D;&#x4E86;&#x7A7A;&#x95F4;&#xFF0C;&#x4E5F;&#x521B;&#x5EFA;&#x4E86;&#x5BF9;&#x8C61;&#x3002;&#x9ED8;&#x8BA4;&#x521D;&#x59CB;&#x5316;&#x4E3A;<code>0</code>&#x3002;&#x540C;&#x65F6;&#x4FEE;&#x6539;&#x4E86;<code>size</code>&#x548C;<code>capacity</code> </span></li>
</ul>
<h3 id="523-&#x5185;&#x5B58;&#x6269;&#x5C55;"><a name="523-&#x5185;&#x5B58;&#x6269;&#x5C55;" class="anchor-navigation-ex-anchor" href="#523-&#x5185;&#x5B58;&#x6269;&#x5C55;"><i class="fa fa-link" aria-hidden="true"></i></a>5.2.3. &#x5185;&#x5B58;&#x6269;&#x5C55;</h3>
<p>&#x5F53;<code>size == capacity</code>&#x65F6;&#xFF0C;&#x8868;&#x793A;<code>vector</code>&#x7533;&#x8BF7;&#x7684;&#x5185;&#x5B58;&#x5DF2;&#x7ECF;&#x88AB;&#x5B58;&#x50A8;&#x5B8C;&#x4E86;&#xFF0C;&#x9700;&#x8981;&#x8FDB;&#x884C;&#x5185;&#x5B58;&#x6269;&#x5F20;&#xFF1A;</p>
<ol>
<li><strong>&#x5B8C;&#x5168;&#x5F03;&#x7528;&#x73B0;&#x6709;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#xFF0C;&#x91CD;&#x65B0;&#x7533;&#x8BF7;&#x66F4;&#x5927;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#xFF1B;</strong></li>
<li><strong>&#x5C06;&#x65E7;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x4E2D;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x6309;&#x539F;&#x6709;&#x987A;&#x5E8F;&#x79FB;&#x52A8;&#x5230;&#x65B0;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x4E2D;&#xFF1B;</strong></li>
<li><strong>&#x6700;&#x540E;&#x5C06;&#x65E7;&#x7684;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x91CA;&#x653E;&#x3002;</strong></li>
</ol>
<blockquote>
<p>[!note|style:flat]
vector &#x5BB9;&#x5668;&#x5728;&#x8FDB;&#x884C;&#x6269;&#x5BB9;&#x540E;&#xFF0C;&#x4E0E;&#x5176;&#x76F8;&#x5173;&#x7684;&#x6307;&#x9488;&#x3001;&#x5F15;&#x7528;&#x4EE5;&#x53CA;&#x8FED;&#x4EE3;&#x5668;&#x53EF;&#x80FD;&#x4F1A;&#x5931;&#x6548;&#x3002;</p>
</blockquote>
<h2 id="53-&#x6392;&#x5E8F;"><a name="53-&#x6392;&#x5E8F;" class="anchor-navigation-ex-anchor" href="#53-&#x6392;&#x5E8F;"><i class="fa fa-link" aria-hidden="true"></i></a>5.3. &#x6392;&#x5E8F;</h2>
<ul>
<li><code>&gt;</code> : &#x4ECE;&#x5927;&#x5230;&#x5C0F;&#x6392;&#x5E8F;</li>
<li><code>&lt;</code> : &#x4ECE;&#x5C0F;&#x5230;&#x5927;&#x6392;&#x5E8F;&#xFF0C;&#x9ED8;&#x8BA4;&#x65B9;&#x5F0F;</li>
</ul>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">class</span> <span class="token class-name">Compare</span><span class="token punctuation">{</span>
<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token comment">// &#x5BF9;&#x8C61;&#x6700;&#x597D;&#x7528;&#x5F15;&#x7528;&#x8FDB;&#x884C;&#x4F20;&#x9012; </span>
    <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">(</span>T <span class="token keyword">const</span> <span class="token operator">&amp;</span> a<span class="token punctuation">,</span>T <span class="token keyword">const</span> <span class="token operator">&amp;</span> b<span class="token punctuation">)</span><span class="token punctuation">{</span>
        <span class="token keyword">return</span> a <span class="token operator">&gt;</span> b<span class="token punctuation">;</span>
    <span class="token punctuation">}</span> 
<span class="token punctuation">}</span><span class="token punctuation">;</span>

<span class="token comment">// &#x8C03;&#x7528;&#x51FD;&#x6570;</span>
<span class="token function">sort</span><span class="token punctuation">(</span>vec<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>vec<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token function">Compare</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h1 id="6-mapmultimap"><a name="6-mapmultimap" class="anchor-navigation-ex-anchor" href="#6-mapmultimap"><i class="fa fa-link" aria-hidden="true"></i></a>6. map/multimap</h1>
<ul>
<li><font color="#f44336">map&#x652F;&#x6301;[ ]&#x8FD0;&#x7B97;&#x7B26;&#xFF0C;multimap&#x4E0D;&#x652F;&#x6301;[ ]&#x8FD0;&#x7B97;&#x7B26;&#x3002;&#x5728;&#x7528;&#x6CD5;&#x4E0A;&#x6CA1;&#x4EC0;&#x4E48;&#x533A;&#x522B;&#x3002;</font></li>
<li><code>key</code> <strong>&#x4E0D;&#x5141;&#x8BB8;&#x4FEE;&#x6539;</strong></li>
</ul>
<pre class="language-"><code class="lang-cpp"><span class="token comment">//&#x5934;&#x6587;&#x4EF6;</span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">&lt;map&gt;</span></span>

<span class="token comment">// &#x521B;&#x5EFA;</span>
map<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token punctuation">,</span> string<span class="token operator">&gt;</span> map<span class="token punctuation">;</span>

<span class="token comment">// &#x4F7F;&#x7528;{}&#x8D4B;&#x503C;&#x662F;&#x4ECE;c++11&#x5F00;&#x59CB;&#x7684;&#xFF0C;&#x56E0;&#x6B64;&#x7F16;&#x8BD1;&#x5668;&#x7248;&#x672C;&#x8FC7;&#x4F4E;&#x65F6;&#x4F1A;&#x62A5;&#x9519;&#xFF0C;&#x5982;visual studio 2012</span>
map<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token punctuation">,</span> string<span class="token operator">&gt;</span> map <span class="token operator">=</span> <span class="token punctuation">{</span>
                <span class="token punctuation">{</span> <span class="token number">2015</span><span class="token punctuation">,</span> <span class="token string">&quot;Jim&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
                <span class="token punctuation">{</span> <span class="token number">2016</span><span class="token punctuation">,</span> <span class="token string">&quot;Tom&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
                <span class="token punctuation">{</span> <span class="token number">2017</span><span class="token punctuation">,</span> <span class="token string">&quot;Bob&quot;</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>

map<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token punctuation">,</span> string<span class="token punctuation">,</span>Compare<span class="token operator">&gt;</span> map<span class="token punctuation">;</span> <span class="token comment">// &#x6307;&#x5B9A;&#x6392;&#x5E8F;&#x89C4;&#x5219;</span>

<span class="token comment">// &#x8FED;&#x4EE3;&#x5668;</span>
map<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token punctuation">,</span>string<span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span>iterator it <span class="token operator">=</span> map<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> 
map<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token punctuation">,</span>string<span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span>iterator it <span class="token operator">=</span> map<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
it<span class="token operator">-&gt;</span>first<span class="token punctuation">;</span> <span class="token comment">// key</span>
it<span class="token operator">-&gt;</span>second<span class="token punctuation">;</span> <span class="token comment">// &#x503C;</span>

<span class="token comment">// &#x6DFB;&#x52A0;key value </span>
pair<span class="token operator">&lt;</span>iterator<span class="token punctuation">,</span><span class="token keyword">bool</span><span class="token operator">&gt;</span> state<span class="token punctuation">;</span><span class="token comment">// &#x80FD;&#x5224;&#x65AD;&#x662F;&#x5426;&#x63D2;&#x5165;&#x6210;&#x529F;;&#x63D2;&#x5165;key&#x5B58;&#x5728;&#x65F6;&#xFF0C;&#x8FD4;&#x56DE;false</span>
state <span class="token operator">=</span> map<span class="token punctuation">.</span><span class="token function">insert</span><span class="token punctuation">(</span><span class="token generic-function"><span class="token function">pair</span><span class="token generic class-name"><span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token punctuation">,</span> string<span class="token operator">&gt;</span></span></span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">&quot;student_one&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> 
state <span class="token operator">=</span> map<span class="token punctuation">.</span><span class="token function">insert</span><span class="token punctuation">(</span><span class="token class-name">map</span><span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token punctuation">,</span> string<span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span><span class="token function">value_type</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">&quot;student_one&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> 

map<span class="token punctuation">[</span>key<span class="token punctuation">]</span> <span class="token operator">=</span> value<span class="token punctuation">;</span> <span class="token comment">// key&#x5B58;&#x5728;&#x5C31;&#x8986;&#x76D6;&#xFF0C;key&#x6CA1;&#x6709;&#x5C31;&#x521B;&#x5EFA;</span>

<span class="token comment">// &#x67E5;&#x627E;</span>
<span class="token comment">// &#x5173;&#x952E;&#x5B57;&#x67E5;&#x8BE2;&#xFF0C;&#x627E;&#x5230;&#x5219;&#x8FD4;&#x56DE;&#x6307;&#x5411;&#x8BE5;&#x5173;&#x952E;&#x5B57;&#x7684;&#x8FED;&#x4EE3;&#x5668;&#xFF0C;&#x5426;&#x5219;&#x8FD4;&#x56DE;&#x6307;&#x5411;end&#x7684;&#x8FED;&#x4EE3;&#x5668;</span>
<span class="token comment">// &#x6839;&#x636E;map&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x8FD4;&#x56DE;&#x7684;&#x8FED;&#x4EE3;&#x5668;&#x4E3A; iterator &#x6216;&#x8005; const_iterator</span>
iterator <span class="token function">find</span> <span class="token punctuation">(</span><span class="token keyword">const</span> key_type<span class="token operator">&amp;</span> k<span class="token punctuation">)</span><span class="token punctuation">;</span>
const_iterator <span class="token function">find</span> <span class="token punctuation">(</span><span class="token keyword">const</span> key_type<span class="token operator">&amp;</span> k<span class="token punctuation">)</span> <span class="token keyword">const</span><span class="token punctuation">;</span>

<span class="token comment">// &#x5220;&#x9664;</span>
<span class="token comment">// &#x5220;&#x9664;&#x8FED;&#x4EE3;&#x5668;&#x6307;&#x5411;&#x4F4D;&#x7F6E;&#x7684;&#x952E;&#x503C;&#x5BF9;&#xFF0C;&#x5E76;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x6307;&#x5411;&#x4E0B;&#x4E00;&#x5143;&#x7D20;&#x7684;&#x8FED;&#x4EE3;&#x5668;</span>
iterator <span class="token function">erase</span><span class="token punctuation">(</span> iterator pos <span class="token punctuation">)</span><span class="token punctuation">;</span>

 <span class="token comment">// &#x6839;&#x636E;Key&#x6765;&#x8FDB;&#x884C;&#x5220;&#x9664;&#xFF0C; &#x8FD4;&#x56DE;&#x5220;&#x9664;&#x7684;&#x5143;&#x7D20;&#x6570;&#x91CF;&#xFF0C;&#x5728;map&#x91CC;&#x7ED3;&#x679C;&#x975E;0&#x5373;1</span>
size_t <span class="token function">erase</span><span class="token punctuation">(</span> <span class="token keyword">const</span> key_type<span class="token operator">&amp;</span> key <span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x5220;&#x9664;&#x4E00;&#x5B9A;&#x8303;&#x56F4;&#x5185;&#x7684;&#x5143;&#x7D20;&#xFF0C;&#x5E76;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x6307;&#x5411;&#x4E0B;&#x4E00;&#x5143;&#x7D20;&#x7684;&#x8FED;&#x4EE3;&#x5668;</span>
iterator <span class="token function">erase</span><span class="token punctuation">(</span> const_iterator first<span class="token punctuation">,</span> const_iterator last <span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x6E05;&#x7A7A;map&#xFF0C;&#x6E05;&#x7A7A;&#x540E;&#x7684;size&#x4E3A;0</span>
<span class="token keyword">void</span> <span class="token function">clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x67E5;&#x8BE2;map&#x662F;&#x5426;&#x4E3A;&#x7A7A;</span>
<span class="token keyword">bool</span> <span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x67E5;&#x8BE2;map&#x4E2D;&#x952E;&#x503C;&#x5BF9;&#x7684;&#x6570;&#x91CF;</span>
size_t <span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x67E5;&#x8BE2;&#x5173;&#x952E;&#x5B57;&#x4E3A;key&#x7684;&#x5143;&#x7D20;&#x7684;&#x4E2A;&#x6570;&#xFF0C;&#x5728;map&#x91CC;&#x7ED3;&#x679C;&#x975E;0&#x5373;1 &#xFF0C;&#x53EF;&#x7528;&#x4E8E;&#x68C0;&#x6D4B;key&#x662F;&#x5426;&#x5305;&#x542B;</span>
size_t <span class="token function">count</span><span class="token punctuation">(</span> <span class="token keyword">const</span> Key<span class="token operator">&amp;</span> key <span class="token punctuation">)</span> <span class="token keyword">const</span><span class="token punctuation">;</span>
</code></pre>
<p><strong>&#x6392;&#x5E8F;&#xFF1A;</strong></p>
<ul>
<li><code>&gt;</code> : &#x4ECE;&#x5927;&#x5230;&#x5C0F;&#x6392;&#x5E8F;</li>
<li><code>&lt;</code> : &#x4ECE;&#x5C0F;&#x5230;&#x5927;&#x6392;&#x5E8F;&#xFF0C;&#x9ED8;&#x8BA4;&#x65B9;&#x5F0F;</li>
<li><code>map<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>string,int,Compaer</span><span class="token punctuation">&gt;</span></span></code></li>
<li><strong><code>map</code> &#x5BF9; <code>key</code> &#x8FDB;&#x884C;&#x6392;&#x5E8F;&#x3002;</strong></li>
<li><code>map</code> <span style="color:red;font-weight:bold"> &#x4E0D;&#x5141;&#x8BB8;&#x5BF9; <code>key</code> &#x8FDB;&#x884C;&#x4FEE;&#x6539;&#xFF0C;&#x6240;&#x4EE5; <code>operator()</code>&#x5F15;&#x7528;&#x4E0E;&#x51FD;&#x6570;&#x5FC5;&#x987B;&#x4E3A; <code>const</code>  </span></li>
</ul>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">class</span> <span class="token class-name">Compare</span><span class="token punctuation">{</span>
<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span> a<span class="token punctuation">,</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span> b<span class="token punctuation">)</span> <span class="token keyword">const</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> a<span class="token punctuation">.</span><span class="token function">c_str</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span> b<span class="token punctuation">.</span><span class="token function">c_str</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> 
<span class="token punctuation">}</span><span class="token punctuation">;</span>
map<span class="token operator">&lt;</span>string<span class="token punctuation">,</span><span class="token keyword">int</span><span class="token punctuation">,</span>Compare<span class="token operator">&gt;</span> names<span class="token punctuation">;</span>
</code></pre>
<h1 id="7-setmultiset"><a name="7-setmultiset" class="anchor-navigation-ex-anchor" href="#7-setmultiset"><i class="fa fa-link" aria-hidden="true"></i></a>7. set/multiset</h1>
<ul>
<li><strong>&#x641C;&#x7D22;&#x3001;&#x79FB;&#x9664;&#x548C;&#x63D2;&#x5165;&#x8BA1;&#x7B97;&#x901F;&#x5EA6; <code>O(log(n))</code></strong>&#x3002;</li>
<li>set &#x901A;&#x5E38;&#x4EE5;&#x7EA2;&#x9ED1;&#x6811;&#x5B9E;&#x73B0;&#x3002;</li>
<li><strong>set&#x4E0D;&#x5141;&#x8BB8;&#x4E24;&#x4E2A;&#x5143;&#x7D20;&#x6709;&#x76F8;&#x540C;&#x503C;</strong>&#x3002;</li>
<li><font color="#f44336">&#x4E0D;&#x80FD;&#x901A;&#x8FC7;set&#x7684;&#x8FED;&#x4EE3;&#x5668;&#x53BB;&#x4FEE;&#x6539;set&#x5143;&#x7D20;&#xFF0C;&#x539F;&#x56E0;&#x662F;&#x4FEE;&#x6539;&#x5143;&#x7D20;&#x4F1A;&#x7834;&#x574F;set&#x7EC4;&#x7EC7;&#x3002;</font> : *it += 1</li>
</ul>
<pre class="language-"><code class="lang-cpp"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;set&gt;</span></span>

<span class="token comment">// &#x521B;&#x5EFA;</span>
set<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span> names<span class="token punctuation">;</span>
set<span class="token operator">&lt;</span>string<span class="token punctuation">,</span>Compare<span class="token operator">&gt;</span> names<span class="token punctuation">;</span> <span class="token comment">// &#x6307;&#x5B9A;&#x6392;&#x5E8F;&#x89C4;&#x5219; </span>

<span class="token comment">// &#x6DFB;&#x52A0;</span>
pair<span class="token operator">&lt;</span>set<span class="token operator">&lt;</span><span class="token keyword">int</span><span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span>iterator<span class="token punctuation">,</span> <span class="token keyword">bool</span><span class="token operator">&gt;</span> ret <span class="token operator">=</span> names<span class="token punctuation">.</span><span class="token function">insert</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x5220;&#x9664;</span>
names<span class="token punctuation">.</span><span class="token function">erease</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
names<span class="token punctuation">.</span><span class="token function">clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x67E5;&#x627E;&#xFF0C;&#x627E;&#x4E0D;&#x5230;&#x8FD4;&#x56DE; end()</span>
set<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span>iterator it <span class="token operator">=</span> names<span class="token punctuation">.</span><span class="token function">find</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token comment">// &#x8FED;&#x4EE3;&#x5668;</span>
set<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span>iterator it <span class="token operator">=</span> names<span class="token punctuation">.</span><span class="token function">begin</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
set<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span><span class="token double-colon punctuation">::</span>iterator it <span class="token operator">=</span> names<span class="token punctuation">.</span><span class="token function">end</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">*</span>it<span class="token punctuation">;</span>

<span class="token comment">// &#x8BA1;&#x6570;</span>
names<span class="token punctuation">.</span><span class="token function">count</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>

names<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
names<span class="token punctuation">.</span><span class="token function">empty</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p><strong>&#x6392;&#x5E8F;&#xFF1A;</strong></p>
<ul>
<li><code>&gt;</code> : &#x4ECE;&#x5927;&#x5230;&#x5C0F;&#x6392;&#x5E8F;</li>
<li><code>&lt;</code> : &#x4ECE;&#x5C0F;&#x5230;&#x5927;&#x6392;&#x5E8F;&#xFF0C;&#x9ED8;&#x8BA4;&#x65B9;&#x5F0F;</li>
<li><code>set</code> <span style="color:red;font-weight:bold"> &#x4E0D;&#x5141;&#x8BB8;&#x5BF9; <code>key</code> &#x8FDB;&#x884C;&#x4FEE;&#x6539;&#xFF0C;&#x6240;&#x4EE5; <code>operator()</code>&#x5F15;&#x7528;&#x5FC5;&#x987B;&#x4E3A; <code>const</code>  </span></li>
</ul>
<pre class="language-"><code class="lang-cpp"><span class="token keyword">class</span> <span class="token class-name">Compare</span><span class="token punctuation">{</span>
<span class="token keyword">public</span><span class="token operator">:</span>
    <span class="token keyword">bool</span> <span class="token keyword">operator</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span> a<span class="token punctuation">,</span><span class="token keyword">const</span> string <span class="token operator">&amp;</span> b<span class="token punctuation">)</span> <span class="token keyword">const</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> a<span class="token punctuation">.</span><span class="token function">c_str</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span> <span class="token operator">&lt;</span> b<span class="token punctuation">.</span><span class="token function">c_str</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> 
<span class="token punctuation">}</span><span class="token punctuation">;</span>
set<span class="token operator">&lt;</span>string<span class="token punctuation">,</span>Compare<span class="token operator">&gt;</span> names<span class="token punctuation">;</span>
</code></pre>
<h1 id="8-deque"><a name="8-deque" class="anchor-navigation-ex-anchor" href="#8-deque"><i class="fa fa-link" aria-hidden="true"></i></a>8. deque</h1>
<pre class="language-"><code class="lang-cpp"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;deque&gt;</span></span>

    <span class="token comment">// &#x521B;&#x5EFA;</span>
    deque<span class="token operator">&lt;</span>string<span class="token operator">&gt;</span> que<span class="token punctuation">;</span>

    <span class="token comment">// &#x9996;&#x5C3E;&#x64CD;&#x4F5C; </span>
    que<span class="token punctuation">.</span><span class="token function">push_back</span><span class="token punctuation">(</span>item<span class="token punctuation">)</span><span class="token punctuation">;</span>
    que<span class="token punctuation">.</span><span class="token function">pop_back</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    que<span class="token punctuation">.</span><span class="token function">push_front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    que<span class="token punctuation">.</span><span class="token function">pop_back</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    que<span class="token punctuation">.</span><span class="token function">front</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    que<span class="token punctuation">.</span><span class="token function">back</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">// &#x5220;&#x9664;</span>
    que<span class="token punctuation">.</span><span class="token function">erase</span><span class="token punctuation">(</span>it<span class="token punctuation">)</span><span class="token punctuation">;</span>
    que<span class="token punctuation">.</span><span class="token function">clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">// &#x67E5;&#x627E; &#x6CA1;&#x6709;&#x67E5;&#x627E; &#x7528; #include&lt;algorithm&gt; &#x5E93;&#x4E2D;&#x7684; find</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="stl_withNum.html" class="navigation navigation-prev " aria-label="Previous page: 八、STL">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="array_list_withNum.html" class="navigation navigation-next " aria-label="Next page: 十、数组链表操作">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"九、数据结构","level":"2.1.9","depth":2,"next":{"title":"十、数组链表操作","level":"2.1.10","depth":2,"path":"cpp/chapter/array_list_withNum.md","ref":"cpp/chapter/array_list_withNum.md","articles":[]},"previous":{"title":"八、STL","level":"2.1.8","depth":2,"path":"cpp/chapter/stl_withNum.md","ref":"cpp/chapter/stl_withNum.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-lunr","-search","search-pro-fixed","expandable-chapters-small","ancre-navigation","hide-element","code","splitter","insert-logo-link-website","-sharing","sharing-plus","prism","-highlight","flexible-alerts","lightbox","pageview-count","auto-scroll-table","katex-pro","favicon-absolute","sectionx","terminull-light","livereload"],"styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"prism":{"css":["prismjs/themes/prism-tomorrow.css"],"lang":{"flow":"typescript"}},"livereload":{},"splitter":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"auto-scroll-table":{},"code":{"copyButtons":true},"terminull-light":{},"search-pro-fixed":{},"favicon-absolute":{"favicon":"image/ico.png","appleTouchIconPrecomposed152":"image/ico.png","appleTouchIconMore":{},"appleTouchIconPrecomposedMore":{}},"hide-element":{"elements":[".gitbook-link"]},"katex-pro":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{"tag":"b"},"lightbox":{"jquery":true,"sameUuid":false},"insert-logo-link-website":{"url":"image/logo.png","link":"https://space.bilibili.com/27206875","target":"_blank","style":"height: 230px"},"pageview-count":{},"ancre-navigation":{"showLevel":true,"associatedWithSummary":true,"mode":"float","printLog":false,"multipleH1":true,"float":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"expandable-chapters-small":{},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"sharing":{"qq":true,"all":["douban","facebook","google","instapaper","linkedin","twitter","weibo","messenger","qq","qzone","viber","whatsapp"],"douban":false,"facebook":false,"weibo":true,"whatsapp":false,"twitter":false,"pocket":false,"google":true,"qzone":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"海拉尔的三角","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"计算机笔记","links":{"sidebar":{"Github":"https://github.com/spite-triangle"}},"gitbook":"*"},"file":{"path":"cpp/chapter/dataStruction_withNum.md","mtime":"2021-09-14T15:43:12.257Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-09-14T15:43:23.052Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro-fixed/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro-fixed/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-insert-logo-link-website/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-auto-scroll-table/plugin.js"></script>
        
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-terminull-light/terminull.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

